<template>
	<view>
		<view class="order" v-for="item in goodslist" :key="item.id">
			<view class="">
				<checkbox-group @change="indent(item.id)">
					<checkbox />
				</checkbox-group>
			</view>
			<view class="">
				<view class="bbb">
					<text>姓名:{{item.username}}</text>
					<text>手机号:{{item.userphone}}</text>
				</view>
				<view class="aaa">
					<text> 地址:{{item.location+item.useraddress}}</text>
					<u-icon name="edit-pen-fill" @click="jia(item)"></u-icon>
				</view>
			</view>
		</view>
		<view class="">
			<u-button class='btn' text="+新建收货地址" @click="site"></u-button>
		</view>

	</view>
</template>
<script>
	import {
		Addresslist,
		addressadd
	} from '@/request/app.js'
	export default {
		data() {
			return {
				goodslist: []
			}
		},
		onLoad() {
			Addresslist({
					uid: uni.getStorageSync("userinfo").uid ? uni.getStorageSync("userinfo").uid : null
				})
				.then(res => {
					// console.log(res, "地址查询");
					this.goodslist = res.data.list
					console.log(this.goodslist, "地址");
				})
		},

		methods: {
			site() {
				uni.navigateTo({
					url: '../site/site'
				})
			},
			// 点击跳转订单页面
			indent(e) {
				console.log(e, "订单");
				uni.navigateTo({
					url: '../indent/indent?id='+e
				})
			},
			// 点击加号编辑
			jia(e) {
				console.log(e, "ee");
				uni.setStorageSync("aaa", e)
				uni.navigateTo({
					url: '../site/site?id=' + e.id + '&username=' + e.username + '&userphone=' + e.userphone +
						'&location=' + e.location + '&useraddress=' + e.useraddress
				})
			}
		}

	}
</script>
<style lang="scss">
	.bbb {
		width: 300px;
		display: flex;
		justify-content: space-between;
		font-size: 18px;
		font-weight: bold;
	}

	.aaa {
		display: flex;
		justify-content: space-between;
		font-size: 16px;
		color: gray;
	}

	.btn {
		width: 80%;
		height: 50px;
		background-color: rgb(234, 50, 35);
		position: fixed;
		border-radius: 10px;
		bottom: 20px;
		left: 10%;
	}

	.order {
		width: 90%;
		height: 60px;
		display: flex;
		// flex-direction: column;
		justify-content: space-around;
		align-items: center;
		margin: 10px auto;
		border: 1px solid red;
	}
</style>
